home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
CGI shell
/
Pocket 6.4
/
Source
/
Interpreter.txt
< prev
next >
Wrap
Text File
|
1993-06-25
|
3KB
|
107 lines
; Interpreter.txt 8:12:05 AM 2/11/87
; add Held 2:45:49 PM 5/31/87
; v 0.3 DA compatable 11:47:16 AM 1/21/88
; add startup routine 9:45:00 AM 3/30/88
; Mon Apr 25, 1988 15:12:04 macros
; Wed Apr 27, 1988 12:30:48 v 0.4
; Mon Jun 03, 1991 23:40:00 restructure
; Wed Apr 01, 1992 00:11:00 remove uflow, add stackSize, numError
; Sun Apr 12, 1992 22:46:00 add fp routines, move user vars to asupport
; Mon Apr 19, 1993 22:58:00 add \
; Fri Jun 11, 1993 01:31:00 move dictionary parts to 'dictionary.txt'
Cold: LEA Bottom,BP ; setup BP [a3]
MOVE.L A1,Expand-Base(BP) ; address of routine in CODE 1
; setup the stacks, PS and RS [a6 & a7]
LEA IntA7-Base(BP),A0 ; A7 is already where it should be.
MOVE.L RS,(A0)+ ; Save initial value of RS at IntA7
MOVEA.L RS,PS
SUBA.W stackSize-base(BP),RS ; variable stack size added 3/30/92
MOVE.L RS,(A0)+ ; save return stack bottom at Rzero
SUBQ.L #8,PS ; leave room for under flow ...
SUBQ.L #2,PS ; ... leave _plenty_ of room
MOVE.L PS,(A0) ; Put parameter stack bot. at Szero
; setup DP [a2]
MOVE FreePt-Base(BP),D0 ; rel compile buffer pointer
LEA 0(BP,D0.W),DP ; abs addr into DP register
; setup Dict [d6]
CLR.L Dict
MOVE DictPt-base(BP),Dict ; rel.addr of the last dict. entry
; set the dictionary size
MOVE freesz-base(BP),-(PS)
JSR grow-base(BP)
; setup the interface
JSR MacStart-base(BP) ; moved 6/3/91
Warm: MOVEA.L Rzero-Base(BP),RS ; reset return stack
MOVEA.L Szero-Base(BP),PS ; reset parameter stack
JSR page-Base(BP) ; clear the page
MOVE newer-base(BP),D0
JSR 0(BP,D0.W) ; run the startup routine
CLR.L fcolon-base(BP)
BSET.B #7,fint-base(BP)
Restart:
BSR.S GetInput ; fill the tib with a line of input
Main: JSR token-Base(BP) ; get the next word of the line
MOVE Dict,-(PS) ; push pointer to last name
JSR search-Base(BP) ; find current token in dictionary
TST (PS)+ ; found NOT IF,
BEQ.S TestNum ; ... assume its a number
BCLR #7,fimmed-base(BP) ; ELSE, immediate? IF
BNE.S doex ; ... do it
TST.B fcolon-base(BP) ; ELSE, compiling? NOT IF,
BEQ.S doex ; ... do it
BCLR #7,fmacro-base(BP) ; ELSE, macro? IF
BNE.S domc
JSR Compile-base(BP) ; ELSE, compile a JSR to it
BRA.S Main
doex: JSR Execute-base(BP)
JSR StkChk-base(BP)
BRA.S Main
domc: JSR mcomp-base(BP)
BRA.S Main
TestNum: ; Test the token for integer or floating point numberness.
JSR here-base(BP) ; get the relative address of token
JSR number-base(BP) ; convert it to a value, if posible
TST (PS)+ ; was it?
BEQ.S testfloat ; if not, test for floating point
TST.B fcolon-base(BP) ; else, are you compiling?
BEQ.S Main ; if not, leave it on the stack
JSR Literal-base(BP) ; else, compile it as a literal
BRA.S Main ; then, get on with it
TestFloat: ; It's not an integer, try floating point.
BCLR #7,fneg-base(BP) ; Is it a negative number?
BEQ.S @0
MOVE.B #$2D,1(A2) ; put in a negative sign
@0: MOVE.L A2,-(PS)
JSR fnum-base(BP) ; do the conversion (handles error)
TST.B fcolon-base(bp) ; if compiling, leave ...
BEQ.S Main ; ... it on the stack.
JSR flit-base(BP) ; else flit it
BRA.S Main
GetInput:
TST.B fint-base(BP)
BEQ Pasting ; Get a line from scrap data
TST.B fcolon-base(BP)
BNE.S Line
JSR Prompt-Base(BP)
BRA.S Line
Line: JSR ClearTermBuf-base(BP)
MOVE #termbuf-base,-(PS)
MOVE #80,-(PS)
JMP expect-base(BP)
; ----- Dictionary Follows ----------